package com.ruoyi.boss.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.boss.domain.TDisputed;
import com.ruoyi.boss.service.ITDisputedService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 疑义账单Controller
 * 
 * @author ruoyi
 * @date 2025-08-17
 */
@RestController
@RequestMapping("/disputed")
public class TDisputedController extends BaseController
{
    @Autowired
    private ITDisputedService tDisputedService;

    /**
     * 查询疑义账单列表
     */
    @RequiresPermissions("boss:disputed:list")
    @GetMapping("/list")
    public TableDataInfo list(TDisputed tDisputed)
    {
        startPage();
        List<TDisputed> list = tDisputedService.selectTDisputedList(tDisputed);
        return getDataTable(list);
    }

    /**
     * 导出疑义账单列表
     */
    @RequiresPermissions("boss:disputed:export")
    @Log(title = "疑义账单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TDisputed tDisputed)
    {
        List<TDisputed> list = tDisputedService.selectTDisputedList(tDisputed);
        ExcelUtil<TDisputed> util = new ExcelUtil<TDisputed>(TDisputed.class);
        util.exportExcel(response, list, "疑义账单数据");
    }

    /**
     * 获取疑义账单详细信息
     */
    @RequiresPermissions("boss:disputed:query")
    @GetMapping(value = "/{disputedId}")
    public AjaxResult getInfo(@PathVariable("disputedId") Long disputedId)
    {
        return success(tDisputedService.selectTDisputedByDisputedId(disputedId));
    }

    /**
     * 新增疑义账单
     */
    @RequiresPermissions("boss:disputed:add")
    @Log(title = "疑义账单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TDisputed tDisputed)
    {
        return toAjax(tDisputedService.insertTDisputed(tDisputed));
    }

    /**
     * 修改疑义账单
     */
    @RequiresPermissions("boss:disputed:edit")
    @Log(title = "疑义账单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TDisputed tDisputed)
    {
        return toAjax(tDisputedService.updateTDisputed(tDisputed));
    }

    /**
     * 删除疑义账单
     */
    @RequiresPermissions("boss:disputed:remove")
    @Log(title = "疑义账单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{disputedIds}")
    public AjaxResult remove(@PathVariable Long[] disputedIds)
    {
        return toAjax(tDisputedService.deleteTDisputedByDisputedIds(disputedIds));
    }
}
